CREATE PROCEDURE DeleteHopDong
	@id int
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	
	delete ThanhToan where HopDongId = @id;

	delete QuyetToanNoiBo where HopDongId = @id;

	delete QuyetToan where HopDongId = @id;

	delete PhieuXuatKho where HopDongId = @id;

	delete KhoiLuongVatTu where HopDongId = @id;

	delete KhoiLuongHopDong where HopDongId = @id;

	delete HopDongDoc where HopDongId = @id;

	delete HopDong where Id = @id;

END
GO
